package top.lixunda.books3.dao;

import org.apache.ibatis.annotations.Param;
import top.lixunda.books3.entity.Book;
import top.lixunda.books3.entity.BookExample;
import top.lixunda.books3.entity.BookWithBLOBs;
import top.lixunda.books3.model.BookTag;
import top.lixunda.books3.model.MediumBook;
import top.lixunda.books3.model.SimpleBook;

import java.util.List;

public interface BookMapper {
    long countByExample(BookExample example);

    int deleteByExample(BookExample example);

    int deleteByPrimaryKey(Long id);

    int insert(BookWithBLOBs record);

    int insertSelective(BookWithBLOBs record);

    List<BookWithBLOBs> selectByExampleWithBLOBs(BookExample example);

    List<Book> selectByExample(BookExample example);

    BookWithBLOBs selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") BookWithBLOBs record, @Param("example") BookExample example);

    int updateByExampleWithBLOBs(@Param("record") BookWithBLOBs record, @Param("example") BookExample example);

    int updateByExample(@Param("record") Book record, @Param("example") BookExample example);

    int updateByPrimaryKeySelective(BookWithBLOBs record);

    int updateByPrimaryKeyWithBLOBs(BookWithBLOBs record);

    int updateByPrimaryKey(Book record);

//    自定义
    long getCountByBookTagList(@Param("bookTags") List<BookTag> bookTags);

    List<SimpleBook> selectSimpleBookByBookTags(@Param("bookTags") List<BookTag> bookTags, @Param("start") long start, @Param("count") long count);

    void updateBookClickTimes(Long id);

//    long getCountByWrapper(@Param("example") BookExample example);
//
//    List<MediumBook> selectMediumBookByWrapper(@Param("example") BookExample example, @Param("start") long start, @Param("count") long count);
}